package br.com.trabalho4.model.shape;

import java.awt.Color;
import java.awt.Graphics;

public class Point implements Shape {
	
	private int x;
	private int y;
	
	private int zoom;
	private Color color;
	
	public Point(int x, int y, int zoom) {
		this.setX(x);
		this.setY(y);
		this.zoom = zoom;
		
		this.color = Color.black;
	}
	
	public Point(int x, int y, Color color) {
		this.setX(x);
		this.setY(y);
		this.zoom = 1;
		
		this.color = color;
	}
	
	public Point(int x, int y, int zoom, Color color) {
		this.setX(x);
		this.setY(y);
		this.zoom = zoom;
		
		this.color = color;
	}

	@Override
	public void draw(Graphics g) {
		Graphics gg = g.create();
		gg.setColor(color);
		gg.fillRect(x*zoom, y*zoom, zoom, zoom);
		gg.dispose();
	}
	
	
	
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + x;
		result = prime * result + y;
		result = prime * result + zoom;
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Point other = (Point) obj;
		if (x != other.x)
			return false;
		if (y != other.y)
			return false;
		return true;
	}
	
	@Override
	public void setZoom(int zoom) {
		this.zoom = zoom;
	}

	public int getX() {
		return x;
	}

	public void setX(int x) {
		this.x = x;
	}

	public int getY() {
		return y;
	}

	public void setY(int y) {
		this.y = y;
	}
	
	public Color getColor() {
		return color;
	}
}
